<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <!-- 2.准备一个容器 -->
     <div id="app">
     <h1>v-modal 表单双向绑定</h1>
    <label>用户:<input type="text" v-model="username"></label>
    <br>
    <br>
    <label >密码： <input type="text" v-model="password"></label>
    <br>
    <br>
    <button @click="submit()">登录</button>
    <button @click="reset()">重置</button>
    <p>数据：{{username}}</p>
    <p>数据：{{password}}</p>
     </div>
    <!-- 1.导入 vue.js -->
     <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
     <script>
         // 3.创建一个Vue实例
     const app=new Vue({
        // 容器
        el:'#app',
        data:{
        username:"",
        password:"",
         
        },
        // 事件处理函数需要写到methods 对象结构中
        methods:{
           submit(){
            alert(`登录的数据为：${this.username},${this.password}}`)
           },
           reset(){
            this.username="";
            this.password="";
           }
        }
     
     })
     </script>
</body>
</html>